package com.socket.socketMoreTest;

import java.io.IOException;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * LoginServer--bdqnPractice
 *
 * @author: Jovi
 * @createTime: 2017-09-06 16:14
 **/
public class LoginServer {

    public static void main(String[] args) {
        try {
            ServerSocket ss = new ServerSocket(8800);
            Socket socket;

            int num = 0;
            while (true) {
                socket = ss.accept();
                ServerThread st = new ServerThread(socket);
                st.start();
                num++;
                System.out.println("customer's num is："+num);

                InetAddress ia = socket.getInetAddress();

                System.out.println("IP:"+ia.getHostAddress()+"\tname:"+ia.getHostName());

            }

        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
